<template>
  <div>
    <TopFilter :list="partDetailedList" :cols="3" :labelWidth="90" @filterChange="changeHandle"></TopFilter>
    <FilterTable
      ref="partTable"
      :columns="partDetailedColumns"
      :isSelectColumn="false"
      :dataSource="listResult"
      :datakey="'rows'"
      :onColumnsChange="columns => this.partDetailedColumns = columns"
    >
      <template slot="controls">
        <el-button size="small" type="primary">导出</el-button>
      </template>
    </FilterTable>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
export default {
  name: 'partDetailed',
  mixins: [dictionary],
  data() {
    this.BaseTable = null;
    return {
      partDetailedList: this.createPartInfoFilterList(),
      // fetchApi:'',
      // fetchParams: { xhrAbort: false },
      listResult:[],
      partDetailedColumns: this.createPartColumns()
    };
  },

  methods: {
    createPartInfoFilterList() {
      return [
        {
          type: 'SELECT',
          label: '仓库',
          fieldName: 'STORAGE_CODE',
          itemList: []
        },
        {
          type: 'DATE',
          label: '会计年度',
          fieldName: 'funcYearMonth',
          valueFormat: 'yyyy-MM-dd'
        },
        {
          type: 'INPUT',
          label: '配件代码',
          fieldName: 'PART_NO'
        },
        {
          type: 'SELECT',
          label: '九大类',
          fieldName: 'partMainType',
          itemList: []
        },
        {
          type: 'SELECT',
          label: '车型组集',
          fieldName: 'PART_MODEL_GROUP_CODE_SET',
          itemList: []
        }
      ];
    },
    createPartColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '仓库',
          dataIndex: 'STORAGE_CODE',
          sorter: true
        },
        {
          title: '库位代码',
          dataIndex: 'STORAGE_POSITION_CODE',
          sorter: true
        },
        {
          title: '配件代码',
          dataIndex: 'PART_NO',
          sorter: true
        },
        {
          title: '配件名称',
          dataIndex: 'PART_NAME',
          sorter: true
        },
        {
          title: '九大类',
          dataIndex: 'PART_MAIN_TYPE',
          sorter: true
        },
        {
          title: '期初数量',
          dataIndex: 'OPEN_QUANTITY',
          sorter: true
        },
        {
          title: '期初单价',
          dataIndex: 'OPEN_PRICE',
          sorter: true
        },
        {
          title: '期初金额',
          dataIndex: 'OPEN_AMOUNT',
          sorter: true
        },
        {
          title: '期末数量',
          dataIndex: 'CLOSE_QUANTITY',
          sorter: true
        },
        {
          title: '期末单价',
          dataIndex: 'CLOSE_PRICE',
          sorter: true
        },
        {
          title: '期末金额',
          dataIndex: 'CLOSE_AMOUNT',
          sorter: true
        },

        {
          title: '入库数量',
          dataIndex: 'IN_QUANTITY',
          sorter: true
        },
        {
          title: '入库金额',
          dataIndex: 'STOCK_IN_AMOUNT',
          sorter: true
        },
        {
          title: '出库数量',
          dataIndex: 'OUT_QUANTITY',
          sorter: true
        },
        {
          title: '出库成本金额',
          dataIndex: 'STOCK_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '出库金额',
          dataIndex: 'OUT_AMOUNT',
          sorter: true
        },
        {
          title: '采购入库数量',
          dataIndex: 'BUY_IN_COUNT',
          sorter: true
        },
        {
          title: '采购入库金额',
          dataIndex: 'BUY_IN_AMOUNT',
          sorter: true
        },
        {
          title: '调拨入库数量',
          dataIndex: 'ALLOCATE_IN_COUNT',
          sorter: true
        },
        {
          title: '调拨入库金额',
          dataIndex: 'ALLOCATE_IN_AMOUNT',
          sorter: true
        },
        {
          title: '移库入库数量',
          dataIndex: 'TRANSFER_IN_COUNT',
          sorter: true
        },
        {
          title: '移库入库金额',
          dataIndex: 'TRANSFER_IN_AMOUNT',
          sorter: true
        },
        {
          title: '其它入库数量',
          dataIndex: 'OTHER_IN_AMOUNT',
          sorter: true
        },
        {
          title: '其它入库金额',
          dataIndex: 'OTHER_IN_COUNT',
          sorter: true
        },
        {
          title: '报溢入库金额',
          dataIndex: 'PROFIT_IN_AMOUNT',
          sorter: true
        },
        {
          title: '报溢入库数量',
          dataIndex: 'PROFIT_IN_COUNT',
          sorter: true
        },
        {
          title: '维修领料数量',
          dataIndex: 'REPAIR_OUT_COUNT',
          sorter: true
        },
        {
          title: '维修领料成本金额',
          dataIndex: 'REPAIR_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '维修领料销售金额',
          dataIndex: 'REPAIR_OUT_SALE_AMOUNT',
          sorter: true
        },
        {
          title: '配件销售数量',
          dataIndex: 'SALE_OUT_COUNT',
          sorter: true
        },
        {
          title: '配件销售销售金额',
          dataIndex: 'SALE_OUT_SALE_AMOUNT',
          sorter: true
        },
        {
          title: '配件销售成本金额',
          dataIndex: 'SALE_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '内部领用数量',
          dataIndex: 'INNER_OUT_COUNT',
          sorter: true
        },
        {
          title: '内部领用成本金额',
          dataIndex: 'INNER_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '内部领用销售金额',
          dataIndex: 'INNER_OUT_SALE_AMOUNT',
          sorter: true
        },
        {
          title: '调拨出库数量',
          dataIndex: 'ALLOCATE_OUT_COUNT',
          sorter: true
        },
        {
          title: '调拨出库成本金额',
          dataIndex: 'ALLOCATE_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '调拨出库销售金额',
          dataIndex: 'ALLOCATE_OUT_SALE_AMOUNT',
          sorter: true
        },
        {
          title: '移库出库数量',
          dataIndex: 'TRANSFER_OUT_COUNT',
          sorter: true
        },

        {
          title: '移库出库成本金额',
          dataIndex: 'TRANSFER_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '报损出库数量',
          dataIndex: 'LOSS_OUT_COUNT',
          sorter: true
        },
        {
          title: '报损出库金额',
          dataIndex: 'LOSS_OUT_AMOUNT',
          sorter: true
        },
        {
          title: '其它出库数量',
          dataIndex: 'OTHER_OUT_COUNT',
          sorter: true
        },
        {
          title: '发料调整差异金额',
          dataIndex: 'OTHER_OUT_SALE_AMOUNT',
          sorter: true
        },
        {
          title: '其它出库成本金额',
          dataIndex: 'OTHER_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '配件车型组集',
          dataIndex: 'PART_MODEL_GROUP_CODE_SET',
          sorter: true
        },
        {
          title: '装潢领料数量',
          dataIndex: 'UPHOLSTER_OUT_COUNT',
          sorter: true
        },
        {
          title: '装潢领料成本金额',
          dataIndex: 'UPHOLSTER_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '装潢领料销售金额',
          dataIndex: 'UPHOLSTER_OUT_SALE_AMOUNT',
          sorter: true
        }
      ];
    },
    changeHandle(val) {
      console.log('val', val);
      this.fetchParams = Object.assign({}, val, { xhrAbort: false });
    }
  },
  mounted() {
    this.BaseTable = this.$refs.partTable.$refs.pageTable;
    let  list={
        STORAGE_CODE:'测试仓库',
        STORAGE_POSITION_CODE:'123456',
        PART_NO:'123456',
        PART_NAME:'制动开关',
        PART_MAIN_TYPE:'',
        OPEN_QUANTITY:10,
        OPEN_PRICE:10.00,
        OPEN_AMOUNT:100.00,
        CLOSE_QUANTITY:9,
        CLOSE_PRICE:10.00,
        CLOSE_AMOUNT:90.00,
        IN_QUANTITY:0,
        STOCK_IN_AMOUNT:0,
        OUT_QUANTITY:1,
        STOCK_OUT_COST_AMOUNT:10.00,
        OUT_AMOUNT:10.00,
        BUY_IN_COUNT:0.00,
        BUY_IN_AMOUNT:0.00,
        ALLOCATE_IN_COUNT	:0.00,
        ALLOCATE_IN_AMOUNT:0.00,
        TRANSFER_IN_COUNT:1,
        TRANSFER_IN_AMOUNT:1,
        OTHER_IN_AMOUNT:10,
        OTHER_IN_COUNT:10,
        PROFIT_IN_AMOUNT:0,
        PROFIT_IN_COUNT:0,
        REPAIR_OUT_COUNT:10,
        REPAIR_OUT_COST_AMOUNT:10.00,
        REPAIR_OUT_SALE_AMOUNT:100.00,
        SALE_OUT_COUNT:1.00,
        SALE_OUT_SALE_AMOUNT:50.00,
        SALE_OUT_COST_AMOUNT:50.00,
        INNER_OUT_COUNT:0,
        INNER_OUT_COST_AMOUNT:0,
        INNER_OUT_SALE_AMOUNT:0,
        ALLOCATE_OUT_COUNT:10.00,
        ALLOCATE_OUT_COST_AMOUNT:10.00,
        ALLOCATE_OUT_SALE_AMOUNT:10.00,
        TRANSFER_OUT_COUNT:10.00,
        TRANSFER_OUT_COST_AMOUNT:10.00,
        LOSS_OUT_COUNT:0,
        LOSS_OUT_AMOUNT:0,
        OTHER_OUT_COUNT:12,
        OTHER_OUT_SALE_AMOUNT:12.00,
        OTHER_OUT_COST_AMOUNT:12.00,
        PART_MODEL_GROUP_CODE_SET:'',
        UPHOLSTER_OUT_COUNT:10,
        UPHOLSTER_OUT_COST_AMOUNT:10,
        UPHOLSTER_OUT_SALE_AMOUNT:10
    }
    this.listResult=[list];
  }
};
</script>

<style scoped lang="less">
</style>
